package fr.univlille1.rmi;

import java.net.MalformedURLException;
import java.rmi.AlreadyBoundException;
import java.rmi.Naming;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;

public class Serveur2 {
	public static void main(String[] args){
		try{
			SiteImpl site = new SiteImpl();
			Naming.bind("2", site);
			SiteItf noeud1 = (SiteItf) Naming.lookup("1");
			noeud1.addNeighbor(site);
			System.out.println("Server2 running");
		} catch(RemoteException ex){
			ex.printStackTrace();
		} catch (MalformedURLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (AlreadyBoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (NotBoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}	
	}
}
